<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>随机点名</title>
</head>
<body>
    <button>点名</button>
    <h3>显示名字</h3>
    <script>
        const btn = document.querySelector('button');
        const text = document.querySelector('h3');
        let arr = ['周静','何嫆','陈源','何艳']
        btn.addEventListener('click',function(){
            //获取数组的随机索引值num(0~arr.length)
           let num =  Math.floor(Math.random()*arr.length);
           //通过num获取数组中的随机值
           text.innerHTML=arr[num];
        })
    </script>
</body>
</html>